package com.spring.sunflower.conversation

import com.spring.sunflower.base.BaseObserver
import com.spring.sunflower.base.BasePresenter
import com.spring.sunflower.bean.LatestVisitorBean
import com.spring.sunflower.bean.LatestVisitorNumBean

/**
 * Created by Kevin on 2021/8/24<br/>
 *
 * Describe:<br/>
 */
class LatestVisitorPresenter(baseView: ConversationContract.LatestVisitorView) :
    BasePresenter<ConversationContract.LatestVisitorView>(baseView) {
    fun getLatestVisitorTotal() {
        val observable = requestDataSource.latestVisitorTotal()
        addDisposable(observable, object : BaseObserver<LatestVisitorNumBean>() {
            override fun onSuccess(bean: LatestVisitorNumBean) {
                baseView.showLatestVisitorTotal(bean.datas)
            }

            override fun onError(status: Int, msg: String?) {
            }
        })
    }

    fun getLatestVisitor(pageIndex: String, type: String) {
        val observable = requestDataSource.latestVisitor(pageIndex, type)
        addDisposable(observable, object : BaseObserver<LatestVisitorBean>() {
            override fun onSuccess(bean: LatestVisitorBean) {
                baseView.showLatestVisitor(bean.datas)
            }

            override fun onError(status: Int, msg: String?) {
            }
        })
    }
}